//
//  SAGlobalSettingsCell.m
//  yidiantong
//
//  Created by 黄志刚 on 2020/10/9.
//
#import "SAGlobalSettingsCell.h"

@interface SAGlobalSettingsCell()

@property (nonatomic, strong) UILabel *titleLab;
@property (nonatomic, strong) UIView *lineView;

@end

@implementation SAGlobalSettingsCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self initUI];
    }
    return self;
}

- (void)refreshCellWithTitle:(NSString *)title AndColour:(UIColor *)colour {
    self.titleLab.textColor = colour;
    self.titleLab.text = title;
}

#pragma mark - initUI

- (void)initUI {

    self.contentView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.titleLab];
    [self.contentView addSubview:self.lineView];
    
    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.mas_equalTo(0);
    }];
        
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.mas_equalTo(0);
        make.height.mas_equalTo(1);
    }];
}

#pragma mark - lazy init

- (UILabel *)titleLab {
    if (!_titleLab) {
        _titleLab = [[UILabel alloc] init];
        _titleLab.font = [UIFont systemFontOfSize:16];
        _titleLab.textColor = kColor(51, 51, 51, 1);
    }
    return _titleLab;
}

- (UIView *)lineView {
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = kLineColor;
    }
    return _lineView;
}

@end
